<template>
    <div id="myBox">
        <van-empty v-if="orderList.length == 0" style="margin-top: 10%;height:500px;" 
        description="没有已完成的订单">

        </van-empty>
        <div class="box01" v-for="(order,index) in orderList" :key="index">
            <div id="title" @click="toShopInfo(order)" style="display: flex;">
                <img :src="order.avatar" width="45px" height="45px" style="border-radius: 5px;" alt="">
                <div class="van-ellipsis" style="width: 140px;margin-left: 5px;">

                    <span
                        style="font-weight: 540;font-size: 15px;letter-spacing: 1px;color: black">{{order.shopName}}</span>
                    <div id="descTime">
                        <span id="time1">接受预定</span>
                        <span id="time2">11:00后配送</span>
                    </div>
                </div>
                <van-icon name="arrow" />
                <span v-if="order.stauts == '7'" style="margin-left: 80px;color: gray;font-size: 14px;">已评价</span>
                <span v-else style="margin-left: 80px;color: gray;font-size: 14px;" >已完成</span>
            </div>
            <div id="imgBox">
                <div  v-for="(food,index) in order.foodList.slice(0,3)" :key="index" @click="showOrderDetail(order)" class="imgFood">
                    <img :src="food.icon" alt="">
                    <p class="van-ellipsis" style="font-size: 13px;margin-top: 2px;">{{food.name}}</p>
                </div>
                 <!-- <van-icon name="arrow" style="margin-left: 5px;margin-top: 40px;"/> -->
            </div>
            <div id="box02">
                <div style="margin-top: 10px;width: 84%;box-sizing: border-box;">
                    <span style="font-weight: 550;"> ¥ {{order.totalMoney.toFixed(2)}}</span>
                    <span style="font-size: 12px;color: gray;margin-left: 2px;"> 共计 {{order.num}} 件</span>
                </div>
                <div>
                    <van-button v-if="order.status == '5'" size="small"   type="warning"  color="orange" 
                    @click="toRemake(order)"
                    style="font-size: 12px;">去评价</van-button>
                </div>
            </div>
        </div>
      
    </div>
</template>
<script>
    export default {
        name: '',
        props: {
            orderList: {
                type: Array,
            }
        },
        data() {
            return {
                showDetailVisable:false,

            }
        },
        components: {},
        computed: {},
        beforeMount() {},
        mounted() {},
        methods: {
            toShopInfo(shop) {
                
                this.$store.state.good.createBy = shop.createBy;
                this.$store.state.shopInfo.createBy = shop.shopCreateBy;
                sessionStorage.setItem('createBy', shop.shopCreateBy)
                sessionStorage.setItem('shopName', shop.name)
                this.$router.push("/shop/");
            },
            showOrderDetail(order){
                this.$emit('showOrderDetail',order)
            },
            toRemake(order){
                sessionStorage.setItem("RemakeOrder",JSON.stringify(order));
                this.$router.push('/order/evaluate',)
            }
        },
        watch: {},
    }
</script>
<style scoped>
    #mybox {
        width: 100%;
        height: 200px;
        overflow: scroll;
    }

    .box01 {
        width: 95%;
        height: 220px;
        background-color: white;
        margin-left: 2.5%;
        margin-top: 2%;
        border-radius: 10px;
        padding: 15px 10px;
        box-sizing: border-box;
    }

    #descTime {
        float: left;
        border: 1px solid rgba(135, 207, 235, 0.858);
        border-radius: 3px;
        width: 120px;
        height: 12px;
        font-size: 12px;
        margin-top: 8px;
    }

    #descTime #time1 {
        color: white;
        background-color: rgba(135, 207, 235, 0.858);
    }

    #descTime #time2 {
        margin-left: 2px;
        color: rgba(135, 207, 235, 0.858);
    }

    #imgBox {
        width: 100%;
        height: 50%;
        /* background-color: red; */
        display: flex;
        padding-top: 10px;
        box-sizing: border-box;
        color: rgba(128, 128, 128, 0.914);
    }

    .imgFood {
        width: 100px;
        height: 100px;
        margin-left: 4%;
    }

    .imgFood p {
        text-align: center;
        color: rgba(128, 128, 128, 0.885);
    }

    #imgBox img {
        border-radius: 5px;
        width: 100px;
        height: 80px;
    }

    #box02 {
        /* background-color: hotpink; */
        width: 100%;
        height: 21%;
        display: flex;
        padding-top: 20px;
        padding-left: 10px;
        box-sizing: border-box;
    }
</style>